CREATE OR REPLACE function sst_insert(sqsChannel IN VARCHAR2, sqsData IN VARCHAR2) return NUMBER AS
/**
 * Is called when data was received and has to be inserted in database table
 * @param sqsChannel Configuration name of channel where data was received
 * @param sqsData	Received data
 */
sqSstId NUMBER;
sqSstTyp NUMBER;

begin
  if(sqsData = 'WATCHDOG' or sqsData = 'DB_WATCHDOG') then
	  return -1;
	end if;
	
  get_sequence('SSTDAT',0,sqSstId);
	if(sqsChannel = 'tr') then
	  sqSstTyp := 6;
	else
	  sqSstTyp := 11;	
	end if;
	insert into SSTDAT (SSTDAT_ID,SSTTYP,SSTSTAT,NUTZDATEN,erst,erstben_id) values (sqSstId,sqSstTyp,1,sqsData,sysdate,0);
	return sqSstId;
end sst_insert;
/
